package com.jeff.tianti.cms.dao;

import com.jeff.tianti.cms.entity.Resume;
import com.jeff.tianti.common.dao.CommonDao;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @author liuyi
 * @desc ResumeDao接口 
 * @date 2019-06-28
 */
public interface ResumeDao extends ResumeDaoCustom,CommonDao<Resume,String>{
    @Query(" from Resume r where r.uid = ?1 and r.deleteFlag=0 ")
    List<Resume> findByUid(String uid);

    /*@Query(value = " SELECT j2.* FROM job_resume_middle j1,job j2 WHERE  j1.`job_id` = j2.`id` AND j2.`delete_flag` = 0 AND j2.`audit_flag`=2  AND j1.`uid` = ?1 ",nativeQuery = true)
    Page<Resume> findByUidAndPage(String uid, Pageable pageable);*/
    @Query(" from Resume r where r.uid = ?1 and r.deleteFlag=0 ")
    Page<Resume> findByUidAndPage(String uid, Pageable pageable);
    @Query(nativeQuery = true,value = " select count(*) from resume r where r.uid = ?1 and r.delete_flag=0  ")
    Integer findCountByUid(String uid);
}